package com.iwhalecloud.bss.kite.cucc.service.attr.linkhandler;

import com.iwhalecloud.bss.kite.cucc.service.attr.LocalAttrHelper;

import com.iwhalecloud.bss.kite.cucc.service.attr.handler.IsIDCOutWordsAttrHandler;

import com.iwhalecloud.bss.kite.listener.handler.attr.annotation.AttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.impl.AbstractAttrLinkageHandler;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @author kangchuang
 * @Date 202103/13
 * 光纤是否IDC外拉联动
 */
@Service
@AttrHandler(IsIDCOutWordsAttrHandler.class)
public class ISIDCOutWordsAttrLinkHandler extends AbstractAttrLinkageHandler<AttrData> {
    @Override
    public void handle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {
        //是否IDC外拉
        KiteAttr enterPriseSelfPurchaseAttr = kiteInst.getAttr("200001832");
        if (Objects.nonNull(enterPriseSelfPurchaseAttr)) {
            //是否IDC外拉为【是】,是否接入互联网要展示
            if ("1_0000106".equals(enterPriseSelfPurchaseAttr.getValue())) {
                LocalAttrHelper.showAndNotNull(kiteInst, "200000136");
            }else {
                LocalAttrHelper.hideAndNullable(kiteInst,"200000136");
            }
        }
    }

    @Override
    public void handleStyle(KiteAttr kiteAttr, KiteInst kiteInst, AttrData attrData) {

    }
}
